package com.hippomeetsskunk.savanna.types.goal;

import com.hippomeetsskunk.savanna.types.meta.ResourceType;
import com.hippomeetsskunk.savanna.types.person.Person;
import com.hippomeetsskunk.savanna.types.person.Skills;
import com.hippomeetsskunk.savanna.types.resource.SimObject;

public class ShoppingGoal extends AbstractGoal implements Goal {

	private final Goal goal;
	
	public ShoppingGoal(Skills requiredSkills,
			Goal goal,
			Person worker) {
		super(worker, requiredSkills, goal.getWorker().getMissingResources(goal.getRequiredResources()), goal.getValue(), goal.getUrgency() + 0.01);
		this.goal = goal;
	}

	public void execute(){
		// have to see how to handle shopping, might be completely rule based
	}
	
	@Override
	public String toString() {
		return "Shopping(" + goal + ")";
	}

	public Goal getGoal() {
		return goal;
	}

	public boolean wtb(SimObject object){
		for(ResourceType t : getRequiredResources()){
			if (object.getType().isA(t)) return true;
		}
		return false;
	}
}
